
<html>
<title>draw - Pygame Documentation</title>
<body bgcolor=#aaeebb text=#000000 link=#331111 vlink=#331111>


<table cellpadding=0 cellspacing=0 border=0 style='border: 3px solid black;' width='100%'>
<tr>
<td bgcolor='#c2fc20' style='padding: 6px;' align=center valign=center><a href='http://www.pygame.org/'><img src='../pygame_tiny.gif' border=0 width=200 height=60></a><br><b>pygame documentation</b></td>
<td bgcolor='#6aee28' style='border-left: 3px solid black; padding: 6px;' align=center valign=center>
	||&nbsp;
	<a href=http://www.pygame.org>Pygame Home</a> &nbsp;||&nbsp;
	<a href=../index.html>Help Contents</a> &nbsp;||
	<a href=index.html>Reference Index</a> &nbsp;||
	<br>&nbsp;<br>
	
<a href=cdrom.html>Cdrom</a>&nbsp;||&nbsp;
<a href=cursors.html>Cursors</a>&nbsp;||&nbsp;
<a href=display.html>Display</a>&nbsp;||&nbsp;
<a href=draw.html>Draw</a>&nbsp;||&nbsp;
<a href=event.html>Event</a>&nbsp;||&nbsp;
<a href=font.html>Font</a>&nbsp;||&nbsp;
<a href=image.html>Image</a>&nbsp;||&nbsp;
<a href=joystick.html>Joystick</a>&nbsp;||&nbsp;
<a href=key.html>Key</a>&nbsp;||&nbsp;
<a href=mixer.html>Mixer</a>&nbsp;||&nbsp;
<a href=mouse.html>Mouse</a>&nbsp;||&nbsp;
<a href=movie.html>Movie</a>&nbsp;||&nbsp;
<a href=music.html>Music</a>&nbsp;||&nbsp;
<a href=overlay.html>Overlay</a>&nbsp;||&nbsp;
<a href=pygame.html>Pygame</a>&nbsp;||&nbsp;
<a href=rect.html>Rect</a>&nbsp;||&nbsp;
<a href=scrap.html>Scrap</a>&nbsp;||&nbsp;
<a href=sndarray.html>Sndarray</a>&nbsp;||&nbsp;
<a href=sprite.html>Sprite</a>&nbsp;||&nbsp;
<a href=surface.html>Surface</a>&nbsp;||&nbsp;
<a href=surfarray.html>Surfarray</a>&nbsp;||&nbsp;
<a href=time.html>Time</a>&nbsp;||&nbsp;
<a href=transform.html>Transform</a>
</td></tr></table>
<br>


<a name="pygame.draw">
<big><b>pygame.draw</big></b><br><ul>
  <i>pygame module for drawing shapes</i><br>
<ul><small><table>
  <tr><td><a href="draw.html#pygame.draw.rect">pygame.draw.rect</a> - <font size=-1>draw a rectangle shape</font></td><td>draw a rectangle shape</td></tr>
  <tr><td><a href="draw.html#pygame.draw.polygon">pygame.draw.polygon</a> - <font size=-1>draw a shape with any number of sides</font></td><td>draw a shape with any number of sides</td></tr>
  <tr><td><a href="draw.html#pygame.draw.circle">pygame.draw.circle</a> - <font size=-1>draw a circle around a point</font></td><td>draw a circle around a point</td></tr>
  <tr><td><a href="draw.html#pygame.draw.ellipse">pygame.draw.ellipse</a> - <font size=-1>draw a round shape inside a rectangle</font></td><td>draw a round shape inside a rectangle</td></tr>
  <tr><td><a href="draw.html#pygame.draw.arc">pygame.draw.arc</a> - <font size=-1>draw a partial section of an ellipse</font></td><td>draw a partial section of an ellipse</td></tr>
  <tr><td><a href="draw.html#pygame.draw.line">pygame.draw.line</a> - <font size=-1>draw a straight line segment</font></td><td>draw a straight line segment</td></tr>
  <tr><td><a href="draw.html#pygame.draw.lines">pygame.draw.lines</a> - <font size=-1>draw multiple contiguous line segments</font></td><td>draw multiple contiguous line segments</td></tr>
  <tr><td><a href="draw.html#pygame.draw.aaline">pygame.draw.aaline</a> - <font size=-1>draw fine antialiased lines</font></td><td>draw fine antialiased lines</td></tr>
  <tr><td><a href="draw.html#pygame.draw.aalines">pygame.draw.aalines</a> - <font size=-1>pygame.draw.aalines(Surface, color, closed, pointlist, blend=1): return Rect</font></td><td>pygame.draw.aalines(Surface, color, closed, pointlist, blend=1): return Rect</td></tr>
</table></small></ul>
<p>Draw several simple shapes to a Surface. These functions will work for rendering to any format of Surface. Rendering to hardware Surfaces will be slower than regular software Surfaces. </p>
<p>Most of the functions take a width argument to represent the size of stroke around the edge of the shape. If a width of 0 is passed the function will actually solid fill the entire shape. </p>
<p>All the drawing functions respect the clip area for the Surface, and will be constrained to that area. The functions return a rectangle representing the bounding area of changed pixels. </p>
<p>Most of the arguments accept a color argument that is an <tt>RGB</tt> triplet. These can also accept an <tt>RGBA</tt> quadruplet. The alpha value will be written directly into the Surface if it contains pixel alphas, but the draw function will not draw transparently. The color argument can also be an integer pixel value that is already mapped to the Surface's pixel format. </p>
<p>These functions must temporarily lock the Surface they are operating on. Many sequential drawing calls can be sped up by locking and unlocking the Surface object around the draw calls. </p>
<!--COMMENTS:pygame.draw--> &nbsp;<br> 


<a name="pygame.draw.rect">
<big><b>pygame.draw.rect</big></b><br><ul>
  <i>draw a rectangle shape</i><br>
  <tt>pygame.draw.rect(Surface, color, Rect, width=0): return Rect</tt><br>
<p>Draws a rectangular shape on the Surface. The given Rect is the area of the rectangle. The width argument is the thickness to draw the outer edge. If width is zero then the rectangle will be filled. </p>
<p>Keep in mind the <tt><a href="surface.html#Surface.fill">Surface.fill</a> - <font size=-1>fill Surface with a solid color</font></tt> method works just as well for drawing filled rectangles. In fact the <tt><a href="surface.html#Surface.fill">Surface.fill</a> - <font size=-1>fill Surface with a solid color</font></tt> can be hardware accelerated on some platforms with both software and hardware display modes. </p>
<!--COMMENTS:pygame.draw.rect--> &nbsp;<br> 
<br></ul>


<a name="pygame.draw.polygon">
<big><b>pygame.draw.polygon</big></b><br><ul>
  <i>draw a shape with any number of sides</i><br>
  <tt>pygame.draw.polygon(Surface, color, pointlist, width=0): return Rect</tt><br>
<p>Draws a polygonal shape on the Surface. The pointlist argument is the vertices of the polygon. The width argument is the thickness to draw the outer edge. If width is zero then the polygon will be filled. </p>
<p>For aapolygon, use aalines with the 'closed' parameter. </p>
<!--COMMENTS:pygame.draw.polygon--> &nbsp;<br> 
<br></ul>


<a name="pygame.draw.circle">
<big><b>pygame.draw.circle</big></b><br><ul>
  <i>draw a circle around a point</i><br>
  <tt>pygame.draw.circle(Surface, color, pos, radius, width=0): return Rect</tt><br>
<p>Draws a circular shape on the Surface. The pos argument is the center of the circle, and radius is the size. The width argument is the thickness to draw the outer edge. If width is zero then the circle will be filled. </p>
<!--COMMENTS:pygame.draw.circle--> &nbsp;<br> 
<br></ul>


<a name="pygame.draw.ellipse">
<big><b>pygame.draw.ellipse</big></b><br><ul>
  <i>draw a round shape inside a rectangle</i><br>
  <tt>pygame.draw.ellipse(Surface, color, Rect, width=0): return Rect</tt><br>
<p>Draws an elliptical shape on the Surface. The given rectangle is the area that the circle will fill. The width argument is the thickness to draw the outer edge. If width is zero then the ellipse will be filled. </p>
<!--COMMENTS:pygame.draw.ellipse--> &nbsp;<br> 
<br></ul>


<a name="pygame.draw.arc">
<big><b>pygame.draw.arc</big></b><br><ul>
  <i>draw a partial section of an ellipse</i><br>
  <tt>pygame.draw.arc(Surface, color, Rect, start_angle, stop_angle, width=1): return Rect</tt><br>
<p>Draws an elliptical arc on the Surface. The rect argument is the area that the ellipse will fill. The two angle arguments are the initial and final angle in radians, with the zero on the right. The width argument is the thickness to draw the outer edge. </p>
<!--COMMENTS:pygame.draw.arc--> &nbsp;<br> 
<br></ul>


<a name="pygame.draw.line">
<big><b>pygame.draw.line</big></b><br><ul>
  <i>draw a straight line segment</i><br>
  <tt>pygame.draw.line(Surface, color, start_pos, end_pos, width=1): return Rect</tt><br>
<p>Draw a straight line segment on a Surface. There are no endcaps, the ends are squared off for thick lines. </p>
<!--COMMENTS:pygame.draw.line--> &nbsp;<br> 
<br></ul>


<a name="pygame.draw.lines">
<big><b>pygame.draw.lines</big></b><br><ul>
  <i>draw multiple contiguous line segments</i><br>
  <tt>pygame.draw.lines(Surface, color, closed, pointlist, width=1): return Rect</tt><br>
<p>Draw a sequence of lines on a Surface. The pointlist argument is a series of points that are connected by a line. If the closed argument is true an additional line segment is drawn between the first and last points. </p>
<p>This does not draw any endcaps or miter joints. Lines with sharp corners and wide line widths can have improper looking corners. </p>
<!--COMMENTS:pygame.draw.lines--> &nbsp;<br> 
<br></ul>


<a name="pygame.draw.aaline">
<big><b>pygame.draw.aaline</big></b><br><ul>
  <i>draw fine antialiased lines</i><br>
  <tt>pygame.draw.aaline(Surface, color, startpos, endpos, blend=1): return Rect</tt><br>
<p>Draws an anti-aliased line on a surface. This will respect the clipping rectangle. <tt>A</tt> bounding box of the affected area is returned returned as a rectangle. If blend is true, the shades will be be blended with existing pixel shades instead of overwriting them. This function accepts floating point values for the end points. </p>
<!--COMMENTS:pygame.draw.aaline--> &nbsp;<br> 
<br></ul>


<a name="pygame.draw.aalines">
<big><b>pygame.draw.aalines</big></b><br><ul>
  <i>pygame.draw.aalines(Surface, color, closed, pointlist, blend=1): return Rect</i><br>
<p>Draws a sequence on a surface. You must pass at least two points in the sequence of points. The closed argument is a simple boolean and if true, a line will be draw between the first and last points. The boolean blend argument set to true will blend the shades with existing shades instead of overwriting them. This function accepts floating point values for the end points. </p>
<!--COMMENTS:pygame.draw.aalines--> &nbsp;<br> 
<br></ul>
<br></ul>

</body></html>
